package com.gmail.andersoninfonet.dao;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;

import com.gmail.andersoninfonet.conexao.ConnectionFactory;
import com.gmail.andersoninfonet.modelo.Funcionario;

public class FuncionarioDAO {
	private Connection con;
	
	public FuncionarioDAO(){
		this.con  = new ConnectionFactory().getConnection();
	}
	
	public void insere(Funcionario f){
		String sql="insert into funcionario (nome,usuario,senha)" + "values(?,?,?)";
		try{
			PreparedStatement stmt = con.prepareStatement(sql);
			stmt.setString(1, f.getNome());
			stmt.setString(2, f.getUsuario());
			stmt.setString(3, f.getSenha());
			
			stmt.execute();
			stmt.close();
		}catch(SQLException e){
			throw new RuntimeException(e);
		}
		
	}

}
